
var TextCover = new Class.create();
TextCover.prototype = {
    containerWidth:80,
    containerHeight:120,
    cover:{
        text:"",
        size:"5",
        top:"10",
        left:"10",
        rotate:"0",
        backGroundColor:"#eee",
        textColor:"#333",
        opacity:0.5,
        padding:"10px",
        style:""
    },
    initialize:function () {
        // this.filter.grayscale = 0
    },
    setText:function (num) {this.cover.text = num;console.log(this.cover);return this;},
    setTop:function (num) {this.cover.top = num;console.log(this.cover);return this;},
    setLeft:function (num) {this.cover.left = num;console.log(this.cover);return this;},
    setSize:function (num) {this.cover.size = num;console.log(this.cover);return this;},
    setRotate:function (num) {this.cover.rotate = num;console.log(this.cover);return this;},
    setOpacity:function (num) {this.cover.opacity = num;console.log(this.cover);return this;},
    getStyle:function () {
        let item = this.cover

        let style = 'font-size:' + item.size / 100 * this.containerWidth + 'vw;'
            +'top:' + item.top / 100 * this.containerHeight + 'vw;'
            +'left:' + item.left / 100 * this.containerWidth + 'vw;'
            +'transform:rotate('+ item.rotate + 'deg);'
        return style
    },
    getData:function () {this.cover.style = this.getStyle();return this.cover;},
    setData:function(data){this.cover = data;return this;},
    reset: function () {

        this.cover = {
            text:"",
            size:"5",
            top:"10",
            left:"10",
            rotate:"0",
            backGroundColor:"#eee",
            textColor:"#333",
            opacity:0.5,
            padding:"10px",
        }
        return this;
    }
}
